package com.itheima.array;

import java.util.Scanner;

public class TestArray {
    public static void main(String[] args) {
        int[] arr = new int[6];
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < arr.length; i++) {
            System.out.println("请输入第"+(i+1)+"裁判的分数");
            //用score去先接收数据 去做出判断 然后进行数组录入
            int score = sc.nextInt();
            if (score>=0&&score<=100){
                //进入数组的值先经过筛选 再将完善的数据存入数组
                arr[i] = score;
            }else {
                System.out.println("你输入的数据有误");
                i--;
            }
        }
        int max = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (max < arr[i]){
                max = arr[i];
            }

        }
        int min = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (min > arr[i]){
                min = arr[i];
            }

        }
        int sum=0;
        for (int i = 0; i < arr.length; i++) {
            sum += arr[i];
        }

        System.out.println("最终成绩为"+((sum-max-min)/4));
    }
}
